<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Canvas Gradient Border Rectangle</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/lottie-web/5.7.9/lottie.min.js"></script>
  </head>
  <body>
    <div id="animationContainer" style="width: 300px; height: 300px"></div>
    <canvas id="canvas" style="width: 300px; height: 300px"></canvas>
    <script>
      lottie.loadAnimation({
        // container: document.getElementById("animationContainer"), // 用于渲染动画的容器元素
        canvas: document.getElementById("canvas"), // 用于渲染动画的容器元素
        // renderer: "png", // 渲染器类型，可以是 'svg', 'canvas', 或 'html'
        loop: true, // 是否循环s播放
        autoplay: true, // 是否自动播放
        src: "./asserts/loading.json", // 动画 JSON 文件的路径
      });
      // fetch("./asserts/loading.json")
      //   .then((response) => response.json())
      //   .then((animationData) => {
      //     console.log(".then ~ animationData:", animationData);
      //     lottie.loadAnimation({
      //       container: document.getElementById("animationContainer"),
      //       renderer: "canvas",
      //       loop: true,
      //       autoplay: true,
      //       animationData: animationData,
      //     });
      //   });
    </script>
  </body>
</html>
